#include<stdio.h>
int main()
{
    //freopen("in.txt","r",stdin);
    int n;
    scanf("%d",&n);
    int min = 10;
    int max = 0;
    int sum = 0;
    for(int i = 0; i < n;i++)
    {
        int a;
        scanf("%d",&a);
        sum+=a;
        if(min > a) min = a;
        if(max < a) max = a;
    }
    sum = sum - min -max;
    printf("%.2f",sum/((n-2)*1.0));
}